﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using HslCommunication.BasicFramework;
using HslCommunication.Core;
using HslCommunication.Core.Address;
using HslCommunication.Core.IMessage;
using HslCommunication.Core.Net;
using HslCommunication.Reflection;

namespace HslCommunication.Profinet.Yokogawa
{
	/// <summary>
	/// 横河PLC的二进制通信类，支持X,Y,I,E,M,T,C,L继电器类型的数据读写，支持D,B,F,R,V,Z,W,TN,CN寄存器类型的数据读写，还支持一些高级的信息读写接口，详细参考API文档。<br />
	/// Yokogawa PLC's binary communication type, supports X, Y, I, E, M, T, C, L relay type data read and write, 
	/// supports D, B, F, R, V, Z, W, TN, CN registers Types of data reading and writing, and some advanced information reading and writing interfaces are also supported. 
	/// Please refer to the API documentation for details.
	/// </summary>
	/// <remarks>
	/// 基础的数据读写面向VIP用户开放，高级的读写随机数据，启动停止命令，读取程序状态，
	/// 系统信息，PLC时间，读写特殊的模块数据需要商业用户授权，读取的数据长度，读取的随机地址长度，在商业授权下，长度不受限制，可以无限大。
	/// </remarks>
	/// <example>
	/// 地址示例如下：
	/// <list type="table">
	///   <listheader>
	///     <term>地址名称</term>
	///     <term>地址代号</term>
	///     <term>示例</term>
	///     <term>字操作</term>
	///     <term>位操作</term>
	///     <term>备注</term>
	///   </listheader>
	///   <item>
	///     <term>Input relay</term>
	///     <term>X</term>
	///     <term>X100,X200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term>只能读，不能写</term>
	///   </item>
	///   <item>
	///     <term>Output relay</term>
	///     <term>Y</term>
	///     <term>Y100,Y200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Internal relay</term>
	///     <term>I</term>
	///     <term>I100,I200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Share relay</term>
	///     <term>E</term>
	///     <term>E100,E200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Special relay</term>
	///     <term>M</term>
	///     <term>M100,M200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Time relay</term>
	///     <term>T</term>
	///     <term>T100,T200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Counter relay</term>
	///     <term>C</term>
	///     <term>C100,C200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>link relay</term>
	///     <term>L</term>
	///     <term>L100, L200</term>
	///     <term>√</term>
	///     <term>√</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Data register</term>
	///     <term>D</term>
	///     <term>D100,D200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>File register</term>
	///     <term>B</term>
	///     <term>B100,B200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term>Only available for sequence CPU modules F3SP22, F3SP25, F3SP28, F3SP35, F3SP38, F3SP53, F3SP58, F3SP59, F3SP66, F3SP67, F3SP71 and F3SP76</term>
	///   </item>
	///   <item>
	///     <term>Cache register</term>
	///     <term>F</term>
	///     <term>F100,F200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term>Only available for sequence CPU modules F3SP71 and F3SP76</term>
	///   </item>
	///   <item>
	///     <term>Shared register</term>
	///     <term>R</term>
	///     <term>R100,R200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Index register</term>
	///     <term>V</term>
	///     <term>V100,V200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Special register</term>
	///     <term>Z</term>
	///     <term>Z100,Z200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Link register</term>
	///     <term>W</term>
	///     <term>W100,W200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Timer current value</term>
	///     <term>TN</term>
	///     <term>TN100,TN200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>Counter current value</term>
	///     <term>CN</term>
	///     <term>CN100,CN200</term>
	///     <term>√</term>
	///     <term>×</term>
	///     <term></term>
	///   </item>
	/// </list>
	/// 例如我们正常读取一个D100的数据如下：
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\YokogawaLinkTcpSample.cs" region="Sample1" title="Read示例" />
	/// 我们在读取的时候可以动态的变更cpu信息，参考下面的代码
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\YokogawaLinkTcpSample.cs" region="Sample2" title="Read示例" />
	/// 关于随机读写的代码示例，可以读写地址分布很散的地址，参考下面的代码
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\YokogawaLinkTcpSample.cs" region="Sample3" title="Read示例" />
	/// 最后看一下读取特殊模块的数据，可以读取基本的字节数据，也可以使用富文本的地址读取
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\YokogawaLinkTcpSample.cs" region="Sample4" title="Read示例" />
	/// </example>
	// Token: 0x02000041 RID: 65
	public class YokogawaLinkTcp : NetworkDeviceBase
	{
		/// <summary>
		/// 实例化一个默认的对象<br />
		/// Instantiate a default object
		/// </summary>
		// Token: 0x0600056E RID: 1390 RVA: 0x00018583 File Offset: 0x00016783
		public YokogawaLinkTcp()
		{
			base.ByteTransform = new ReverseWordTransform();
			base.ByteTransform.DataFormat = DataFormat.CDAB;
			this.CpuNumber = 1;
		}

		/// <summary>
		/// 指定IP地址和端口号来实例化一个对象<br />
		/// Specify the IP address and port number to instantiate an object
		/// </summary>
		/// <param name="ipAddress">Ip地址</param>
		/// <param name="port">端口号</param>
		// Token: 0x0600056F RID: 1391 RVA: 0x000185AE File Offset: 0x000167AE
		public YokogawaLinkTcp(string ipAddress, int port)
		{
			base.ByteTransform = new ReverseWordTransform();
			base.ByteTransform.DataFormat = DataFormat.CDAB;
			this.IpAddress = ipAddress;
			this.Port = port;
			this.CpuNumber = 1;
		}

		/// <inheritdoc />
		// Token: 0x06000570 RID: 1392 RVA: 0x000185E9 File Offset: 0x000167E9
		protected override INetMessage GetNewNetMessage()
		{
			return new YokogawaLinkBinaryMessage();
		}

		/// <summary>
		/// 获取或设置当前的CPU Number，默认值为1<br />
		/// Get or set the current CPU Number, the default value is 1
		/// </summary>
		// Token: 0x1700012E RID: 302
		// (get) Token: 0x06000571 RID: 1393 RVA: 0x000185F0 File Offset: 0x000167F0
		// (set) Token: 0x06000572 RID: 1394 RVA: 0x000185F8 File Offset: 0x000167F8
		public byte CpuNumber { get; set; }

		/// <inheritdoc />
		/// <remarks>
		/// 读取的线圈地址支持X,Y,I,E,M,T,C,L，寄存器地址支持D,B,F,R,V,Z,W,TN,CN，举例：D100；也可以携带CPU进行访问，举例：cpu=2;D100<br />
		/// <b>[商业授权]</b> 如果想要读取特殊模块的数据，需要使用 <b>Special:</b> 开头标记，举例：Special:unit=0;slot=1;100<br />
		/// The read coil address supports X, Y, I, E, M, T, C, L, and the register address supports D, B, F, R, V, Z, W, TN, CN, for example: D100; 
		/// it can also be carried CPU access, for example: cpu=2;D100. <br />
		/// <b>[Authorization]</b> If you want to read the data of a special module, you need to use the <b>Special:</b> beginning tag, for example: Special:unit=0;slot=1;100
		/// </remarks>
		// Token: 0x06000573 RID: 1395 RVA: 0x00018604 File Offset: 0x00016804
		[HslMqttApi("ReadByteArray", "Supports X,Y,I,E,M,T,C,L,D,B,F,R,V,Z,W,TN,CN, for example: D100; or cpu=2;D100 or Special:unit=0;slot=1;100")]
		public override OperateResult<byte[]> Read(string address, ushort length)
		{
			bool flag = address.StartsWith("Special:") || address.StartsWith("special:");
			OperateResult<List<byte[]>> operateResult;
			if (flag)
			{
				bool flag2 = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
				if (flag2)
				{
					return new OperateResult<byte[]>(StringResources.Language.InsufficientPrivileges);
				}
				operateResult = YokogawaLinkTcp.BuildReadSpecialModule(this.CpuNumber, address, length);
			}
			else
			{
				operateResult = YokogawaLinkTcp.BuildReadCommand(this.CpuNumber, address, length, false);
			}
			bool flag3 = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag3)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				List<byte> list = new List<byte>();
				for (int i = 0; i < operateResult.Content.Count; i++)
				{
					OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content[i]);
					bool flag4 = !operateResult2.IsSuccess;
					if (flag4)
					{
						return operateResult2;
					}
					OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
					list.AddRange(operateResult3.Content);
				}
				result = OperateResult.CreateSuccessResult<byte[]>(list.ToArray());
			}
			return result;
		}

		/// <inheritdoc />
		/// <remarks>
		/// 写入的线圈地址支持Y,I,E,M,T,C,L，寄存器地址支持D,B,F,R,V,Z,W,TN,CN，举例：D100；也可以携带CPU进行访问，举例：cpu=2;D100<br />
		/// 如果想要写入特殊模块的数据，需要使用 <b>Special:</b> 开头标记，举例：Special:unit=0;slot=1;100<br />
		/// The read coil address supports Y, I, E, M, T, C, L, and the register address supports D, B, F, R, V, Z, W, TN, CN, for example: D100; 
		/// it can also be carried CPU access, for example: cpu=2;D100.
		/// If you want to read the data of a special module, you need to use the <b>Special:</b> beginning tag, for example: Special:unit=0;slot=1;100
		/// </remarks>
		// Token: 0x06000574 RID: 1396 RVA: 0x00018710 File Offset: 0x00016910
		[HslMqttApi("WriteByteArray", "Supports Y,I,E,M,T,C,L,D,B,F,R,V,Z,W,TN,CN, for example: D100; or cpu=2;D100 or Special:unit=0;slot=1;100")]
		public override OperateResult Write(string address, byte[] value)
		{
			bool flag = address.StartsWith("Special:") || address.StartsWith("special:");
			OperateResult<byte[]> operateResult;
			if (flag)
			{
				bool flag2 = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
				if (flag2)
				{
					return new OperateResult(StringResources.Language.InsufficientPrivileges);
				}
				operateResult = YokogawaLinkTcp.BuildWriteSpecialModule(this.CpuNumber, address, value);
			}
			else
			{
				operateResult = YokogawaLinkTcp.BuildWriteWordCommand(this.CpuNumber, address, value);
			}
			bool flag3 = !operateResult.IsSuccess;
			OperateResult result;
			if (flag3)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag4 = !operateResult2.IsSuccess;
				if (flag4)
				{
					result = operateResult2;
				}
				else
				{
					result = YokogawaLinkTcp.CheckContent(operateResult2.Content);
				}
			}
			return result;
		}

		/// <inheritdoc />
		/// <remarks>
		/// 读取的线圈地址支持X,Y,I,E,M,T,C,L，举例：Y100；也可以携带CPU进行访问，举例：cpu=2;Y100<br />
		/// The read coil address supports X, Y, I, E, M, T, C, L, for example: Y100; you can also carry the CPU for access, for example: cpu=2;Y100
		/// </remarks>
		// Token: 0x06000575 RID: 1397 RVA: 0x000187C4 File Offset: 0x000169C4
		[HslMqttApi("ReadBoolArray", "Read coil address supports X, Y, I, E, M, T, C, L, for example: Y100; or cpu=2;Y100")]
		public override OperateResult<bool[]> ReadBool(string address, ushort length)
		{
			OperateResult<List<byte[]>> operateResult = YokogawaLinkTcp.BuildReadCommand(this.CpuNumber, address, length, true);
			bool flag = !operateResult.IsSuccess;
			OperateResult<bool[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool[]>(operateResult);
			}
			else
			{
				List<byte> list = new List<byte>();
				for (int i = 0; i < operateResult.Content.Count; i++)
				{
					OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content[i]);
					bool flag2 = !operateResult2.IsSuccess;
					if (flag2)
					{
						return OperateResult.CreateFailedResult<bool[]>(operateResult2);
					}
					OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						return OperateResult.CreateFailedResult<bool[]>(operateResult3);
					}
					list.AddRange(operateResult3.Content);
				}
				result = OperateResult.CreateSuccessResult<bool[]>(Enumerable.ToArray<bool>(Enumerable.Select<byte, bool>(list.ToArray(), (byte m) => m > 0)));
			}
			return result;
		}

		/// <inheritdoc />
		/// <remarks>
		/// 写入的线圈地址支持Y,I,E,M,T,C,L，举例：Y100；也可以携带CPU进行访问，举例：cpu=2;Y100<br />
		/// The write coil address supports Y, I, E, M, T, C, L, for example: Y100; you can also carry the CPU for access, for example: cpu=2;Y100
		/// </remarks>
		// Token: 0x06000576 RID: 1398 RVA: 0x000188C8 File Offset: 0x00016AC8
		[HslMqttApi("WriteBoolArray", "The write coil address supports Y, I, E, M, T, C, L, for example: Y100; or cpu=2;Y100")]
		public override OperateResult Write(string address, bool[] value)
		{
			OperateResult<byte[]> operateResult = YokogawaLinkTcp.BuildWriteBoolCommand(this.CpuNumber, address, value);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					result = YokogawaLinkTcp.CheckContent(operateResult2.Content);
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机读取<see cref="T:System.Boolean" />数组信息，主需要出传入<see cref="T:System.Boolean" />数组地址信息，就可以返回批量<see cref="T:System.Boolean" />值<br />
		/// <b>[Authorization]</b> Random read <see cref="T:System.Boolean" /> array information, the master needs to pass in the <see cref="T:System.Boolean" /> array address information, and then the batch can be returned to <see cref="T:System.Boolean" /> value
		/// </summary> 
		/// <param name="address">批量地址信息</param>
		/// <remarks>
		/// 读取的线圈地址支持X,Y,I,E,M,T,C,L，举例：Y100；也可以携带CPU进行访问，举例：cpu=2;Y100<br />
		/// The read coil address supports X, Y, I, E, M, T, C, L, for example: Y100; you can also carry the CPU for access, for example: cpu=2;Y100
		/// </remarks>
		/// <returns>带有成功标志的Bool数组信息</returns>
		// Token: 0x06000577 RID: 1399 RVA: 0x00018924 File Offset: 0x00016B24
		[HslMqttApi(Description = "Read random relay, supports X, Y, I, E, M, T, C, L, for example: Y100;")]
		public OperateResult<bool[]> ReadRandomBool(string[] address)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<bool[]> result;
			if (flag)
			{
				result = new OperateResult<bool[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				OperateResult<List<byte[]>> operateResult = YokogawaLinkTcp.BuildReadRandomCommand(this.CpuNumber, address, true);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool[]>(operateResult);
				}
				else
				{
					List<bool> list = new List<bool>();
					foreach (byte[] send in operateResult.Content)
					{
						OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(send);
						bool flag3 = !operateResult2.IsSuccess;
						if (flag3)
						{
							return OperateResult.CreateFailedResult<bool[]>(operateResult2);
						}
						OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
						bool flag4 = !operateResult3.IsSuccess;
						if (flag4)
						{
							return OperateResult.CreateFailedResult<bool[]>(operateResult3);
						}
						list.AddRange(Enumerable.Select<byte, bool>(operateResult3.Content, (byte m) => m > 0));
					}
					result = OperateResult.CreateSuccessResult<bool[]>(list.ToArray());
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机写入<see cref="T:System.Boolean" />数组信息，主需要出传入<see cref="T:System.Boolean" />数组地址信息，以及对应的<see cref="T:System.Boolean" />数组值<br />
		/// <b>[Authorization]</b> Randomly write the <see cref="T:System.Boolean" /> array information, the main need to pass in the <see cref="T:System.Boolean" /> array address information, 
		/// and the corresponding <see cref="T:System.Boolean" /> array value
		/// </summary>
		/// <param name="address">批量地址信息</param>
		/// <param name="value">批量的数据值信息</param>
		/// <remarks>
		/// 写入的线圈地址支持Y,I,E,M,T,C,L，举例：Y100；也可以携带CPU进行访问，举例：cpu=2;Y100<br />
		/// The write coil address supports Y, I, E, M, T, C, L, for example: Y100; you can also carry the CPU for access, for example: cpu=2;Y100
		/// </remarks>
		/// <returns>是否写入成功</returns>
		// Token: 0x06000578 RID: 1400 RVA: 0x00018A60 File Offset: 0x00016C60
		[HslMqttApi(Description = "Write random relay, supports Y, I, E, M, T, C, L, for example: Y100;")]
		public OperateResult WriteRandomBool(string[] address, bool[] value)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult result;
			if (flag)
			{
				result = new OperateResult<bool[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				bool flag2 = address.Length != value.Length;
				if (flag2)
				{
					result = new OperateResult(StringResources.Language.TwoParametersLengthIsNotSame);
				}
				else
				{
					OperateResult<byte[]> operateResult = YokogawaLinkTcp.BuildWriteRandomBoolCommand(this.CpuNumber, address, value);
					bool flag3 = !operateResult.IsSuccess;
					if (flag3)
					{
						result = operateResult;
					}
					else
					{
						OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
						bool flag4 = !operateResult2.IsSuccess;
						if (flag4)
						{
							result = operateResult2;
						}
						else
						{
							OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
							bool flag5 = !operateResult3.IsSuccess;
							if (flag5)
							{
								result = operateResult3;
							}
							else
							{
								result = OperateResult.CreateSuccessResult();
							}
						}
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机读取<see cref="T:System.Byte" />数组信息，主需要出传入<see cref="T:System.Byte" />数组地址信息，就可以返回批量<see cref="T:System.Byte" />值<br />
		/// <b>[Authorization]</b> Random read <see cref="T:System.Byte" /> array information, the master needs to pass in the <see cref="T:System.Byte" /> array address information, and then the batch can be returned to <see cref="T:System.Byte" /> value
		/// </summary> 
		/// <param name="address">批量地址信息</param>
		/// <remarks>
		/// </remarks>
		/// <returns>带有成功标志的Bool数组信息</returns>
		// Token: 0x06000579 RID: 1401 RVA: 0x00018B24 File Offset: 0x00016D24
		[HslMqttApi(Description = "Read random register, supports D,B,F,R,V,Z,W,TN,CN，example: D100")]
		public OperateResult<byte[]> ReadRandom(string[] address)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				OperateResult<List<byte[]>> operateResult = YokogawaLinkTcp.BuildReadRandomCommand(this.CpuNumber, address, false);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult);
				}
				else
				{
					List<byte> list = new List<byte>();
					foreach (byte[] send in operateResult.Content)
					{
						OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(send);
						bool flag3 = !operateResult2.IsSuccess;
						if (flag3)
						{
							return OperateResult.CreateFailedResult<byte[]>(operateResult2);
						}
						OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
						bool flag4 = !operateResult3.IsSuccess;
						if (flag4)
						{
							return OperateResult.CreateFailedResult<byte[]>(operateResult3);
						}
						list.AddRange(operateResult3.Content);
					}
					result = OperateResult.CreateSuccessResult<byte[]>(list.ToArray());
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机读取<see cref="T:System.Int16" />数组信息，主需要出传入<see cref="T:System.Int16" />数组地址信息，就可以返回批量<see cref="T:System.Int16" />值<br />
		/// <b>[Authorization]</b> Random read <see cref="T:System.Int16" /> array information, the master needs to pass in the <see cref="T:System.Int16" /> array address information, and then the batch can be returned to <see cref="T:System.Int16" /> value
		/// </summary> 
		/// <param name="address">批量地址信息</param>
		/// <returns>带有成功标志的Bool数组信息</returns>
		// Token: 0x0600057A RID: 1402 RVA: 0x00018C30 File Offset: 0x00016E30
		[HslMqttApi(Description = "Read random register, and get short array, supports D, B, F, R, V, Z, W, TN, CN，example: D100")]
		public OperateResult<short[]> ReadRandomInt16(string[] address)
		{
			return this.ReadRandom(address).Then<short[]>((byte[] m) => OperateResult.CreateSuccessResult<short[]>(this.ByteTransform.TransInt16(m, 0, address.Length)));
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机读取<see cref="T:System.UInt16" />数组信息，主需要出传入<see cref="T:System.UInt16" />数组地址信息，就可以返回批量<see cref="T:System.UInt16" />值<br />
		/// <b>[Authorization]</b> Random read <see cref="T:System.UInt16" /> array information, the master needs to pass in the <see cref="T:System.UInt16" /> array address information, and then the batch can be returned to <see cref="T:System.UInt16" /> value
		/// </summary> 
		/// <param name="address">批量地址信息</param>
		/// <returns>带有成功标志的Bool数组信息</returns>
		// Token: 0x0600057B RID: 1403 RVA: 0x00018C70 File Offset: 0x00016E70
		[HslMqttApi(Description = "Read random register, and get ushort array, supports D, B, F, R, V, Z, W, TN, CN，example: D100")]
		public OperateResult<ushort[]> ReadRandomUInt16(string[] address)
		{
			return this.ReadRandom(address).Then<ushort[]>((byte[] m) => OperateResult.CreateSuccessResult<ushort[]>(this.ByteTransform.TransUInt16(m, 0, address.Length)));
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机写入<see cref="T:System.Byte" />数组信息，主需要出传入<see cref="T:System.Byte" />数组地址信息，以及对应的<see cref="T:System.Byte" />数组值<br />
		/// <b>[Authorization]</b> Randomly write the <see cref="T:System.Byte" /> array information, the main need to pass in the <see cref="T:System.Byte" /> array address information, 
		/// and the corresponding <see cref="T:System.Byte" /> array value
		/// </summary>
		/// <param name="address">批量地址信息</param>
		/// <param name="value">批量的数据值信息</param>
		/// <returns>是否写入成功</returns>
		// Token: 0x0600057C RID: 1404 RVA: 0x00018CB0 File Offset: 0x00016EB0
		[HslMqttApi(ApiTopic = "WriteRandom", Description = "Randomly write the byte array information, the main need to pass in the byte array address information")]
		public OperateResult WriteRandom(string[] address, byte[] value)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult result;
			if (flag)
			{
				result = new OperateResult<bool[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				bool flag2 = address.Length * 2 != value.Length;
				if (flag2)
				{
					result = new OperateResult(StringResources.Language.TwoParametersLengthIsNotSame);
				}
				else
				{
					OperateResult<byte[]> operateResult = YokogawaLinkTcp.BuildWriteRandomWordCommand(this.CpuNumber, address, value);
					bool flag3 = !operateResult.IsSuccess;
					if (flag3)
					{
						result = operateResult;
					}
					else
					{
						OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
						bool flag4 = !operateResult2.IsSuccess;
						if (flag4)
						{
							result = operateResult2;
						}
						else
						{
							OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
							bool flag5 = !operateResult3.IsSuccess;
							if (flag5)
							{
								result = operateResult3;
							}
							else
							{
								result = OperateResult.CreateSuccessResult();
							}
						}
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机写入<see cref="T:System.Int16" />数组信息，主需要出传入<see cref="T:System.Int16" />数组地址信息，以及对应的<see cref="T:System.Int16" />数组值<br />
		/// <b>[Authorization]</b> Randomly write the <see cref="T:System.Int16" /> array information, the main need to pass in the <see cref="T:System.Int16" /> array address information, 
		/// and the corresponding <see cref="T:System.Int16" /> array value
		/// </summary>
		/// <param name="address">批量地址信息</param>
		/// <param name="value">批量的数据值信息</param>
		/// <returns>是否写入成功</returns>
		// Token: 0x0600057D RID: 1405 RVA: 0x00018D74 File Offset: 0x00016F74
		[HslMqttApi(ApiTopic = "WriteRandomInt16", Description = "Randomly write the short array information, the main need to pass in the short array address information")]
		public OperateResult WriteRandom(string[] address, short[] value)
		{
			return this.WriteRandom(address, base.ByteTransform.TransByte(value));
		}

		/// <summary>
		/// <b>[商业授权]</b> 随机写入<see cref="T:System.UInt16" />数组信息，主需要出传入<see cref="T:System.UInt16" />数组地址信息，以及对应的<see cref="T:System.UInt16" />数组值<br />
		/// <b>[Authorization]</b> Randomly write the <see cref="T:System.UInt16" /> array information, the main need to pass in the <see cref="T:System.UInt16" /> array address information, 
		/// and the corresponding <see cref="T:System.UInt16" /> array value
		/// </summary>
		/// <param name="address">批量地址信息</param>
		/// <param name="value">批量的数据值信息</param>
		/// <returns>是否写入成功</returns>
		// Token: 0x0600057E RID: 1406 RVA: 0x00018D89 File Offset: 0x00016F89
		[HslMqttApi(ApiTopic = "WriteRandomUInt16", Description = "Randomly write the ushort array information, the main need to pass in the ushort array address information")]
		public OperateResult WriteRandom(string[] address, ushort[] value)
		{
			return this.WriteRandom(address, base.ByteTransform.TransByte(value));
		}

		/// <inheritdoc />
		// Token: 0x0600057F RID: 1407 RVA: 0x00018DA0 File Offset: 0x00016FA0
		[DebuggerStepThrough]
		public override Task<OperateResult<byte[]>> ReadAsync(string address, ushort length)
		{
			YokogawaLinkTcp.<ReadAsync>d__19 <ReadAsync>d__ = new YokogawaLinkTcp.<ReadAsync>d__19();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadAsync>d__19>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000580 RID: 1408 RVA: 0x00018DF4 File Offset: 0x00016FF4
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, byte[] value)
		{
			YokogawaLinkTcp.<WriteAsync>d__20 <WriteAsync>d__ = new YokogawaLinkTcp.<WriteAsync>d__20();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteAsync>d__20>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000581 RID: 1409 RVA: 0x00018E48 File Offset: 0x00017048
		[DebuggerStepThrough]
		public override Task<OperateResult<bool[]>> ReadBoolAsync(string address, ushort length)
		{
			YokogawaLinkTcp.<ReadBoolAsync>d__21 <ReadBoolAsync>d__ = new YokogawaLinkTcp.<ReadBoolAsync>d__21();
			<ReadBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool[]>>.Create();
			<ReadBoolAsync>d__.<>4__this = this;
			<ReadBoolAsync>d__.address = address;
			<ReadBoolAsync>d__.length = length;
			<ReadBoolAsync>d__.<>1__state = -1;
			<ReadBoolAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadBoolAsync>d__21>(ref <ReadBoolAsync>d__);
			return <ReadBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000582 RID: 1410 RVA: 0x00018E9C File Offset: 0x0001709C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, bool[] value)
		{
			YokogawaLinkTcp.<WriteAsync>d__22 <WriteAsync>d__ = new YokogawaLinkTcp.<WriteAsync>d__22();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteAsync>d__22>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadRandomBool(System.String[])" />
		// Token: 0x06000583 RID: 1411 RVA: 0x00018EF0 File Offset: 0x000170F0
		[DebuggerStepThrough]
		public Task<OperateResult<bool[]>> ReadRandomBoolAsync(string[] address)
		{
			YokogawaLinkTcp.<ReadRandomBoolAsync>d__23 <ReadRandomBoolAsync>d__ = new YokogawaLinkTcp.<ReadRandomBoolAsync>d__23();
			<ReadRandomBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool[]>>.Create();
			<ReadRandomBoolAsync>d__.<>4__this = this;
			<ReadRandomBoolAsync>d__.address = address;
			<ReadRandomBoolAsync>d__.<>1__state = -1;
			<ReadRandomBoolAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadRandomBoolAsync>d__23>(ref <ReadRandomBoolAsync>d__);
			return <ReadRandomBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.WriteRandomBool(System.String[],System.Boolean[])" />
		// Token: 0x06000584 RID: 1412 RVA: 0x00018F3C File Offset: 0x0001713C
		[DebuggerStepThrough]
		public Task<OperateResult> WriteRandomBoolAsync(string[] address, bool[] value)
		{
			YokogawaLinkTcp.<WriteRandomBoolAsync>d__24 <WriteRandomBoolAsync>d__ = new YokogawaLinkTcp.<WriteRandomBoolAsync>d__24();
			<WriteRandomBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteRandomBoolAsync>d__.<>4__this = this;
			<WriteRandomBoolAsync>d__.address = address;
			<WriteRandomBoolAsync>d__.value = value;
			<WriteRandomBoolAsync>d__.<>1__state = -1;
			<WriteRandomBoolAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteRandomBoolAsync>d__24>(ref <WriteRandomBoolAsync>d__);
			return <WriteRandomBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadRandom(System.String[])" />
		// Token: 0x06000585 RID: 1413 RVA: 0x00018F90 File Offset: 0x00017190
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadRandomAsync(string[] address)
		{
			YokogawaLinkTcp.<ReadRandomAsync>d__25 <ReadRandomAsync>d__ = new YokogawaLinkTcp.<ReadRandomAsync>d__25();
			<ReadRandomAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadRandomAsync>d__.<>4__this = this;
			<ReadRandomAsync>d__.address = address;
			<ReadRandomAsync>d__.<>1__state = -1;
			<ReadRandomAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadRandomAsync>d__25>(ref <ReadRandomAsync>d__);
			return <ReadRandomAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadRandomInt16(System.String[])" />
		// Token: 0x06000586 RID: 1414 RVA: 0x00018FDC File Offset: 0x000171DC
		[DebuggerStepThrough]
		public Task<OperateResult<short[]>> ReadRandomInt16Async(string[] address)
		{
			YokogawaLinkTcp.<ReadRandomInt16Async>d__26 <ReadRandomInt16Async>d__ = new YokogawaLinkTcp.<ReadRandomInt16Async>d__26();
			<ReadRandomInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<short[]>>.Create();
			<ReadRandomInt16Async>d__.<>4__this = this;
			<ReadRandomInt16Async>d__.address = address;
			<ReadRandomInt16Async>d__.<>1__state = -1;
			<ReadRandomInt16Async>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadRandomInt16Async>d__26>(ref <ReadRandomInt16Async>d__);
			return <ReadRandomInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadRandomUInt16(System.String[])" />
		// Token: 0x06000587 RID: 1415 RVA: 0x00019028 File Offset: 0x00017228
		[DebuggerStepThrough]
		public Task<OperateResult<ushort[]>> ReadRandomUInt16Async(string[] address)
		{
			YokogawaLinkTcp.<ReadRandomUInt16Async>d__27 <ReadRandomUInt16Async>d__ = new YokogawaLinkTcp.<ReadRandomUInt16Async>d__27();
			<ReadRandomUInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<ushort[]>>.Create();
			<ReadRandomUInt16Async>d__.<>4__this = this;
			<ReadRandomUInt16Async>d__.address = address;
			<ReadRandomUInt16Async>d__.<>1__state = -1;
			<ReadRandomUInt16Async>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadRandomUInt16Async>d__27>(ref <ReadRandomUInt16Async>d__);
			return <ReadRandomUInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.WriteRandom(System.String[],System.Byte[])" />
		// Token: 0x06000588 RID: 1416 RVA: 0x00019074 File Offset: 0x00017274
		[DebuggerStepThrough]
		public Task<OperateResult> WriteRandomAsync(string[] address, byte[] value)
		{
			YokogawaLinkTcp.<WriteRandomAsync>d__28 <WriteRandomAsync>d__ = new YokogawaLinkTcp.<WriteRandomAsync>d__28();
			<WriteRandomAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteRandomAsync>d__.<>4__this = this;
			<WriteRandomAsync>d__.address = address;
			<WriteRandomAsync>d__.value = value;
			<WriteRandomAsync>d__.<>1__state = -1;
			<WriteRandomAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteRandomAsync>d__28>(ref <WriteRandomAsync>d__);
			return <WriteRandomAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.WriteRandom(System.String[],System.Int16[])" />
		// Token: 0x06000589 RID: 1417 RVA: 0x000190C8 File Offset: 0x000172C8
		[DebuggerStepThrough]
		public Task<OperateResult> WriteRandomAsync(string[] address, short[] value)
		{
			YokogawaLinkTcp.<WriteRandomAsync>d__29 <WriteRandomAsync>d__ = new YokogawaLinkTcp.<WriteRandomAsync>d__29();
			<WriteRandomAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteRandomAsync>d__.<>4__this = this;
			<WriteRandomAsync>d__.address = address;
			<WriteRandomAsync>d__.value = value;
			<WriteRandomAsync>d__.<>1__state = -1;
			<WriteRandomAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteRandomAsync>d__29>(ref <WriteRandomAsync>d__);
			return <WriteRandomAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.WriteRandom(System.String[],System.UInt16[])" />
		// Token: 0x0600058A RID: 1418 RVA: 0x0001911C File Offset: 0x0001731C
		[DebuggerStepThrough]
		public Task<OperateResult> WriteRandomAsync(string[] address, ushort[] value)
		{
			YokogawaLinkTcp.<WriteRandomAsync>d__30 <WriteRandomAsync>d__ = new YokogawaLinkTcp.<WriteRandomAsync>d__30();
			<WriteRandomAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteRandomAsync>d__.<>4__this = this;
			<WriteRandomAsync>d__.address = address;
			<WriteRandomAsync>d__.value = value;
			<WriteRandomAsync>d__.<>1__state = -1;
			<WriteRandomAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<WriteRandomAsync>d__30>(ref <WriteRandomAsync>d__);
			return <WriteRandomAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// <b>[商业授权]</b> 如果未执行程序，则开始执行程序<br />
		/// <b>[Authorization]</b> Starts executing a program if it is not being executed
		/// </summary>
		/// <remarks>
		/// This command will be ignored if it is executed while a program is being executed.<br />
		/// Refer to the users manual for the individual modules for the response formats that are used at error times.
		/// </remarks>
		/// <returns>是否启动成功</returns>
		// Token: 0x0600058B RID: 1419 RVA: 0x00019170 File Offset: 0x00017370
		[HslMqttApi(Description = "Starts executing a program if it is not being executed")]
		public OperateResult Start()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				OperateResult<byte[]> operateResult = YokogawaLinkTcp.BuildStartCommand(this.CpuNumber);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = operateResult;
				}
				else
				{
					OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = operateResult2;
					}
					else
					{
						OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
						bool flag4 = !operateResult3.IsSuccess;
						if (flag4)
						{
							result = operateResult3;
						}
						else
						{
							result = OperateResult.CreateSuccessResult();
						}
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 停止当前正在执行程序<br />
		/// <b>[Authorization]</b> Stops the executing program.
		/// </summary>
		/// <remarks>
		/// This command will be ignored if it is executed when no program is being executed.<br />
		/// Refer to the users manual for the individual modules for the response formats that are used at error times.
		/// </remarks>
		/// <returns>是否启动成功</returns>
		// Token: 0x0600058C RID: 1420 RVA: 0x0001920C File Offset: 0x0001740C
		[HslMqttApi(Description = "Stops the executing program.")]
		public OperateResult Stop()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				OperateResult<byte[]> operateResult = YokogawaLinkTcp.BuildStopCommand(this.CpuNumber);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = operateResult;
				}
				else
				{
					OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = operateResult2;
					}
					else
					{
						OperateResult<byte[]> operateResult3 = YokogawaLinkTcp.CheckContent(operateResult2.Content);
						bool flag4 = !operateResult3.IsSuccess;
						if (flag4)
						{
							result = operateResult3;
						}
						else
						{
							result = OperateResult.CreateSuccessResult();
						}
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 重置当前的模块，当前打开的连接被强制关闭。 模块中所做的设置也将被清除。然后当前对象需要重连PLC。<br />
		/// <b>[Authorization]</b> When this command is executed via an Ethernet interface module or an Ethernet connection of an F3SP66, F3SP67, 
		/// F3SP71 or F3SP76 sequence CPU module, the connection which is currently open is forced to close. 
		/// The settings made in the modules are also cleared. Then the current object needs to reconnect to the PLC.
		/// </summary>
		/// <returns>是否重置成功</returns>
		// Token: 0x0600058D RID: 1421 RVA: 0x000192A8 File Offset: 0x000174A8
		[HslMqttApi(Description = "Reset the connection which is currently open is forced to close")]
		public OperateResult ModuleReset()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				byte[] array = new byte[4];
				array[0] = 97;
				array[1] = this.CpuNumber;
				OperateResult<byte[]> operateResult = base.ReadFromCoreServer(array, false);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = operateResult;
				}
				else
				{
					result = OperateResult.CreateSuccessResult();
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 读取当前PLC的程序状态，返回1：RUN；2：Stop；3：Debug；255：ROM writer<br />
		/// <b>[Authorization]</b> Read the program status. return code 1:RUN; 2:Stop; 3:Debug; 255:ROM writer
		/// </summary>
		/// <returns>当前PLC的程序状态，返回1：RUN；2：Stop；3：Debug；255：ROM writer</returns>
		// Token: 0x0600058E RID: 1422 RVA: 0x0001930C File Offset: 0x0001750C
		[HslMqttApi(Description = "Read the program status. return code 1:RUN; 2:Stop; 3:Debug; 255:ROM writer")]
		public OperateResult<int> ReadProgramStatus()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<int> result;
			if (flag)
			{
				result = new OperateResult<int>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				byte[] array = new byte[]
				{
					98,
					0,
					0,
					2,
					0,
					1
				};
				array[1] = this.CpuNumber;
				OperateResult<byte[]> operateResult = base.ReadFromCoreServer(array);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<int>(operateResult);
				}
				else
				{
					OperateResult<byte[]> operateResult2 = YokogawaLinkTcp.CheckContent(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<int>(operateResult2);
					}
					else
					{
						result = OperateResult.CreateSuccessResult<int>((int)operateResult2.Content[1]);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 读取当前PLC的系统状态，系统的ID，CPU类型，程序大小信息<br />
		/// <b>[Authorization]</b> Read current PLC system status, system ID, CPU type, program size information
		/// </summary>
		/// <returns>系统信息的结果对象</returns>
		// Token: 0x0600058F RID: 1423 RVA: 0x000193A8 File Offset: 0x000175A8
		[HslMqttApi(Description = "Read current PLC system status, system ID, CPU type, program size information")]
		public OperateResult<YokogawaSystemInfo> ReadSystemInfo()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<YokogawaSystemInfo> result;
			if (flag)
			{
				result = new OperateResult<YokogawaSystemInfo>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				byte[] array = new byte[]
				{
					98,
					0,
					0,
					2,
					0,
					2
				};
				array[1] = this.CpuNumber;
				OperateResult<byte[]> operateResult = base.ReadFromCoreServer(array);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<YokogawaSystemInfo>(operateResult);
				}
				else
				{
					OperateResult<byte[]> operateResult2 = YokogawaLinkTcp.CheckContent(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<YokogawaSystemInfo>(operateResult2);
					}
					else
					{
						result = YokogawaSystemInfo.Prase(operateResult2.Content);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 读取当前PLC的时间信息，包含年月日时分秒<br />
		/// <b>[Authorization]</b> Read current PLC time information, including year, month, day, hour, minute, and second
		/// </summary>
		/// <returns>PLC的当前的时间信息</returns>
		// Token: 0x06000590 RID: 1424 RVA: 0x00019444 File Offset: 0x00017644
		[HslMqttApi(Description = "Read current PLC time information, including year, month, day, hour, minute, and second")]
		public OperateResult<DateTime> ReadDateTime()
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<DateTime> result;
			if (flag)
			{
				result = new OperateResult<DateTime>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				byte[] array = new byte[4];
				array[0] = 99;
				array[1] = this.CpuNumber;
				OperateResult<byte[]> operateResult = base.ReadFromCoreServer(array);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<DateTime>(operateResult);
				}
				else
				{
					OperateResult<byte[]> operateResult2 = YokogawaLinkTcp.CheckContent(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<DateTime>(operateResult2);
					}
					else
					{
						result = OperateResult.CreateSuccessResult<DateTime>(new DateTime((int)(2000 + base.ByteTransform.TransUInt16(operateResult2.Content, 0)), (int)base.ByteTransform.TransUInt16(operateResult2.Content, 2), (int)base.ByteTransform.TransUInt16(operateResult2.Content, 4), (int)base.ByteTransform.TransUInt16(operateResult2.Content, 6), (int)base.ByteTransform.TransUInt16(operateResult2.Content, 8), (int)base.ByteTransform.TransUInt16(operateResult2.Content, 10)));
					}
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 读取特殊模块的数据信息，需要指定模块单元号，模块站号，数据地址，长度信息。<br />
		/// <b>[Authorization]</b> To read the data information of a special module, you need to specify the module unit number, module slot number, data address, and length information.
		/// </summary>
		/// <param name="moduleUnit">模块的单元号</param>
		/// <param name="moduleSlot">模块的站号</param>
		/// <param name="dataPosition">模块的数据地址</param>
		/// <param name="length">长度信息</param>
		/// <returns>带有成功标识的byte[]，可以自行解析出所需要的各种类型的数据</returns>
		// Token: 0x06000591 RID: 1425 RVA: 0x00019554 File Offset: 0x00017754
		[HslMqttApi(Description = "Read the data information of a special module, you need to specify the module unit number, module slot number, data address, and length information.")]
		public OperateResult<byte[]> ReadSpecialModule(byte moduleUnit, byte moduleSlot, ushort dataPosition, ushort length)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				List<byte> list = new List<byte>();
				List<byte[]> list2 = YokogawaLinkTcp.BuildReadSpecialModule(this.CpuNumber, moduleUnit, moduleSlot, dataPosition, length);
				for (int i = 0; i < list2.Count; i++)
				{
					OperateResult<byte[]> operateResult = base.ReadFromCoreServer(list2[i]);
					bool flag2 = !operateResult.IsSuccess;
					if (flag2)
					{
						return OperateResult.CreateFailedResult<byte[]>(operateResult);
					}
					OperateResult<byte[]> operateResult2 = YokogawaLinkTcp.CheckContent(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						return OperateResult.CreateFailedResult<byte[]>(operateResult2);
					}
					list.AddRange(operateResult2.Content);
				}
				result = OperateResult.CreateSuccessResult<byte[]>(list.ToArray());
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.Start" />
		// Token: 0x06000592 RID: 1426 RVA: 0x00019628 File Offset: 0x00017828
		[DebuggerStepThrough]
		public Task<OperateResult> StartAsync()
		{
			YokogawaLinkTcp.<StartAsync>d__38 <StartAsync>d__ = new YokogawaLinkTcp.<StartAsync>d__38();
			<StartAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<StartAsync>d__.<>4__this = this;
			<StartAsync>d__.<>1__state = -1;
			<StartAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<StartAsync>d__38>(ref <StartAsync>d__);
			return <StartAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.Stop" />
		// Token: 0x06000593 RID: 1427 RVA: 0x0001966C File Offset: 0x0001786C
		[DebuggerStepThrough]
		public Task<OperateResult> StopAsync()
		{
			YokogawaLinkTcp.<StopAsync>d__39 <StopAsync>d__ = new YokogawaLinkTcp.<StopAsync>d__39();
			<StopAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<StopAsync>d__.<>4__this = this;
			<StopAsync>d__.<>1__state = -1;
			<StopAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<StopAsync>d__39>(ref <StopAsync>d__);
			return <StopAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ModuleReset" />
		// Token: 0x06000594 RID: 1428 RVA: 0x000196B0 File Offset: 0x000178B0
		[DebuggerStepThrough]
		public Task<OperateResult> ModuleResetAsync()
		{
			YokogawaLinkTcp.<ModuleResetAsync>d__40 <ModuleResetAsync>d__ = new YokogawaLinkTcp.<ModuleResetAsync>d__40();
			<ModuleResetAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<ModuleResetAsync>d__.<>4__this = this;
			<ModuleResetAsync>d__.<>1__state = -1;
			<ModuleResetAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ModuleResetAsync>d__40>(ref <ModuleResetAsync>d__);
			return <ModuleResetAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadProgramStatus" />
		// Token: 0x06000595 RID: 1429 RVA: 0x000196F4 File Offset: 0x000178F4
		[DebuggerStepThrough]
		public Task<OperateResult<int>> ReadProgramStatusAsync()
		{
			YokogawaLinkTcp.<ReadProgramStatusAsync>d__41 <ReadProgramStatusAsync>d__ = new YokogawaLinkTcp.<ReadProgramStatusAsync>d__41();
			<ReadProgramStatusAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<int>>.Create();
			<ReadProgramStatusAsync>d__.<>4__this = this;
			<ReadProgramStatusAsync>d__.<>1__state = -1;
			<ReadProgramStatusAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadProgramStatusAsync>d__41>(ref <ReadProgramStatusAsync>d__);
			return <ReadProgramStatusAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadSystemInfo" />
		// Token: 0x06000596 RID: 1430 RVA: 0x00019738 File Offset: 0x00017938
		[DebuggerStepThrough]
		public Task<OperateResult<YokogawaSystemInfo>> ReadSystemInfoAsync()
		{
			YokogawaLinkTcp.<ReadSystemInfoAsync>d__42 <ReadSystemInfoAsync>d__ = new YokogawaLinkTcp.<ReadSystemInfoAsync>d__42();
			<ReadSystemInfoAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<YokogawaSystemInfo>>.Create();
			<ReadSystemInfoAsync>d__.<>4__this = this;
			<ReadSystemInfoAsync>d__.<>1__state = -1;
			<ReadSystemInfoAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadSystemInfoAsync>d__42>(ref <ReadSystemInfoAsync>d__);
			return <ReadSystemInfoAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadDateTime" />
		// Token: 0x06000597 RID: 1431 RVA: 0x0001977C File Offset: 0x0001797C
		[DebuggerStepThrough]
		public Task<OperateResult<DateTime>> ReadDateTimeAsync()
		{
			YokogawaLinkTcp.<ReadDateTimeAsync>d__43 <ReadDateTimeAsync>d__ = new YokogawaLinkTcp.<ReadDateTimeAsync>d__43();
			<ReadDateTimeAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<DateTime>>.Create();
			<ReadDateTimeAsync>d__.<>4__this = this;
			<ReadDateTimeAsync>d__.<>1__state = -1;
			<ReadDateTimeAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadDateTimeAsync>d__43>(ref <ReadDateTimeAsync>d__);
			return <ReadDateTimeAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Yokogawa.YokogawaLinkTcp.ReadSpecialModule(System.Byte,System.Byte,System.UInt16,System.UInt16)" />
		// Token: 0x06000598 RID: 1432 RVA: 0x000197C0 File Offset: 0x000179C0
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadSpecialModuleAsync(byte moduleUnit, byte moduleSlot, ushort dataPosition, ushort length)
		{
			YokogawaLinkTcp.<ReadSpecialModuleAsync>d__44 <ReadSpecialModuleAsync>d__ = new YokogawaLinkTcp.<ReadSpecialModuleAsync>d__44();
			<ReadSpecialModuleAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadSpecialModuleAsync>d__.<>4__this = this;
			<ReadSpecialModuleAsync>d__.moduleUnit = moduleUnit;
			<ReadSpecialModuleAsync>d__.moduleSlot = moduleSlot;
			<ReadSpecialModuleAsync>d__.dataPosition = dataPosition;
			<ReadSpecialModuleAsync>d__.length = length;
			<ReadSpecialModuleAsync>d__.<>1__state = -1;
			<ReadSpecialModuleAsync>d__.<>t__builder.Start<YokogawaLinkTcp.<ReadSpecialModuleAsync>d__44>(ref <ReadSpecialModuleAsync>d__);
			return <ReadSpecialModuleAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 检查当前的反馈内容，如果没有发生错误，就解析出实际的数据内容。<br />
		/// Check the current feedback content, if there is no error, parse out the actual data content.
		/// </summary>
		/// <param name="content">原始的数据内容</param>
		/// <returns>解析之后的数据内容</returns>
		// Token: 0x06000599 RID: 1433 RVA: 0x00019824 File Offset: 0x00017A24
		public static OperateResult<byte[]> CheckContent(byte[] content)
		{
			bool flag = content[1] > 0;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(YokogawaLinkHelper.GetErrorMsg(content[1]));
			}
			else
			{
				bool flag2 = content.Length > 4;
				if (flag2)
				{
					result = OperateResult.CreateSuccessResult<byte[]>(content.RemoveBegin(4));
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(new byte[0]);
				}
			}
			return result;
		}

		/// <summary>
		/// 构建读取命令的原始报文信息
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">地址数据信息</param>
		/// <param name="length">数据长度信息</param>
		/// <param name="isBit">是否位访问</param>
		/// <returns>实际的读取的报文信息</returns>
		// Token: 0x0600059A RID: 1434 RVA: 0x00019874 File Offset: 0x00017A74
		public static OperateResult<List<byte[]>> BuildReadCommand(byte cpu, string address, ushort length, bool isBit)
		{
			cpu = (byte)HslHelper.ExtractParameter(ref address, "cpu", (int)cpu);
			OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(address, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult<List<byte[]>> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<List<byte[]>>(operateResult);
			}
			else
			{
				bool flag2 = Authorization.asdniasnfaksndiqwhawfskhfaiw();
				OperateResult<int[], int[]> operateResult2;
				if (flag2)
				{
					if (isBit)
					{
						operateResult2 = HslHelper.SplitReadLength(operateResult.Content.AddressStart, length, 256);
					}
					else
					{
						operateResult2 = HslHelper.SplitReadLength(operateResult.Content.AddressStart, length, 64);
					}
				}
				else
				{
					operateResult2 = HslHelper.SplitReadLength(operateResult.Content.AddressStart, length, ushort.MaxValue);
				}
				List<byte[]> list = new List<byte[]>();
				for (int i = 0; i < operateResult2.Content1.Length; i++)
				{
					operateResult.Content.AddressStart = operateResult2.Content1[i];
					byte[] array = new byte[12];
					array[0] = (isBit ? 1 : 17);
					array[1] = cpu;
					array[2] = 0;
					array[3] = 8;
					operateResult.Content.GetAddressBinaryContent().CopyTo(array, 4);
					array[10] = BitConverter.GetBytes(operateResult2.Content2[i])[1];
					array[11] = BitConverter.GetBytes(operateResult2.Content2[i])[0];
					list.Add(array);
				}
				result = OperateResult.CreateSuccessResult<List<byte[]>>(list);
			}
			return result;
		}

		/// <summary>
		/// 构建随机读取的原始报文的初始命令
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">实际的数据地址信息</param>
		/// <param name="isBit">是否是位读取</param>
		/// <returns>实际的读取的报文信息</returns>
		// Token: 0x0600059B RID: 1435 RVA: 0x000199C8 File Offset: 0x00017BC8
		public static OperateResult<List<byte[]>> BuildReadRandomCommand(byte cpu, string[] address, bool isBit)
		{
			List<string[]> list = SoftBasic.ArraySplitByLength<string>(address, 32);
			List<byte[]> list2 = new List<byte[]>();
			foreach (string[] array in list)
			{
				byte[] array2 = new byte[6 + 6 * array.Length];
				array2[0] = (isBit ? 4 : 20);
				array2[1] = cpu;
				array2[2] = BitConverter.GetBytes(array2.Length - 4)[1];
				array2[3] = BitConverter.GetBytes(array2.Length - 4)[0];
				array2[4] = BitConverter.GetBytes(array.Length)[1];
				array2[5] = BitConverter.GetBytes(array.Length)[0];
				for (int i = 0; i < array.Length; i++)
				{
					array2[1] = (byte)HslHelper.ExtractParameter(ref array[i], "cpu", (int)cpu);
					OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(array[i], 1);
					bool flag = !operateResult.IsSuccess;
					if (flag)
					{
						return OperateResult.CreateFailedResult<List<byte[]>>(operateResult);
					}
					operateResult.Content.GetAddressBinaryContent().CopyTo(array2, 6 * i + 6);
				}
				list2.Add(array2);
			}
			return OperateResult.CreateSuccessResult<List<byte[]>>(list2);
		}

		/// <summary>
		/// 构建批量写入Bool数组的命令，需要指定CPU Number信息和设备地址信息
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">设备地址数据</param>
		/// <param name="value">实际的bool数组</param>
		/// <returns>构建的写入指令</returns>
		// Token: 0x0600059C RID: 1436 RVA: 0x00019B10 File Offset: 0x00017D10
		public static OperateResult<byte[]> BuildWriteBoolCommand(byte cpu, string address, bool[] value)
		{
			cpu = (byte)HslHelper.ExtractParameter(ref address, "cpu", (int)cpu);
			OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(address, 0);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				byte[] array = new byte[12 + value.Length];
				array[0] = 2;
				array[1] = cpu;
				array[2] = 0;
				array[3] = (byte)(8 + value.Length);
				operateResult.Content.GetAddressBinaryContent().CopyTo(array, 4);
				array[10] = BitConverter.GetBytes(value.Length)[1];
				array[11] = BitConverter.GetBytes(value.Length)[0];
				for (int i = 0; i < value.Length; i++)
				{
					array[12 + i] = (value[i] ? 1 : 0);
				}
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <summary>
		/// 构建批量随机写入Bool数组的命令，需要指定CPU Number信息和设备地址信息
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">设备地址数据</param>
		/// <param name="value">实际的bool数组</param>
		/// <returns>构建的写入指令</returns>
		// Token: 0x0600059D RID: 1437 RVA: 0x00019BD4 File Offset: 0x00017DD4
		public static OperateResult<byte[]> BuildWriteRandomBoolCommand(byte cpu, string[] address, bool[] value)
		{
			bool flag = address.Length != value.Length;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(StringResources.Language.TwoParametersLengthIsNotSame);
			}
			else
			{
				byte[] array = new byte[6 + address.Length * 8 - 1];
				array[0] = 5;
				array[1] = cpu;
				array[2] = BitConverter.GetBytes(array.Length - 4)[1];
				array[3] = BitConverter.GetBytes(array.Length - 4)[0];
				array[4] = BitConverter.GetBytes(address.Length)[1];
				array[5] = BitConverter.GetBytes(address.Length)[0];
				for (int i = 0; i < address.Length; i++)
				{
					array[1] = (byte)HslHelper.ExtractParameter(ref address[i], "cpu", (int)cpu);
					OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(address[i], 0);
					bool flag2 = !operateResult.IsSuccess;
					if (flag2)
					{
						return OperateResult.CreateFailedResult<byte[]>(operateResult);
					}
					operateResult.Content.GetAddressBinaryContent().CopyTo(array, 6 + 8 * i);
					array[12 + 8 * i] = (value[i] ? 1 : 0);
				}
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <summary>
		/// 构建字写入的命令报文信息，需要指定设备地址
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">地址</param>
		/// <param name="value">原始的数据值</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x0600059E RID: 1438 RVA: 0x00019CDC File Offset: 0x00017EDC
		public static OperateResult<byte[]> BuildWriteWordCommand(byte cpu, string address, byte[] value)
		{
			cpu = (byte)HslHelper.ExtractParameter(ref address, "cpu", (int)cpu);
			OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(address, 0);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				byte[] array = new byte[12 + value.Length];
				array[0] = 18;
				array[1] = cpu;
				array[2] = 0;
				array[3] = (byte)(8 + value.Length);
				operateResult.Content.GetAddressBinaryContent().CopyTo(array, 4);
				array[10] = BitConverter.GetBytes(value.Length / 2)[1];
				array[11] = BitConverter.GetBytes(value.Length / 2)[0];
				value.CopyTo(array, 12);
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <summary>
		/// 构建随机写入字的命令的报文
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">地址</param>
		/// <param name="value">原始的数据值</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x0600059F RID: 1439 RVA: 0x00019D84 File Offset: 0x00017F84
		public static OperateResult<byte[]> BuildWriteRandomWordCommand(byte cpu, string[] address, byte[] value)
		{
			bool flag = address.Length * 2 != value.Length;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(StringResources.Language.TwoParametersLengthIsNotSame);
			}
			else
			{
				byte[] array = new byte[6 + address.Length * 8];
				array[0] = 21;
				array[1] = cpu;
				array[2] = BitConverter.GetBytes(array.Length - 4)[1];
				array[3] = BitConverter.GetBytes(array.Length - 4)[0];
				array[4] = BitConverter.GetBytes(address.Length)[1];
				array[5] = BitConverter.GetBytes(address.Length)[0];
				for (int i = 0; i < address.Length; i++)
				{
					array[1] = (byte)HslHelper.ExtractParameter(ref address[i], "cpu", (int)cpu);
					OperateResult<YokogawaLinkAddress> operateResult = YokogawaLinkAddress.ParseFrom(address[i], 0);
					bool flag2 = !operateResult.IsSuccess;
					if (flag2)
					{
						return OperateResult.CreateFailedResult<byte[]>(operateResult);
					}
					operateResult.Content.GetAddressBinaryContent().CopyTo(array, 6 + 8 * i);
					array[12 + 8 * i] = value[i * 2];
					array[13 + 8 * i] = value[i * 2 + 1];
				}
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <summary>
		/// 构建启动PLC的命令报文
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A0 RID: 1440 RVA: 0x00019E98 File Offset: 0x00018098
		public static OperateResult<byte[]> BuildStartCommand(byte cpu)
		{
			byte[] array = new byte[4];
			array[0] = 69;
			array[1] = cpu;
			return OperateResult.CreateSuccessResult<byte[]>(array);
		}

		/// <summary>
		/// 构建停止PLC的命令报文
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A1 RID: 1441 RVA: 0x00019EC0 File Offset: 0x000180C0
		public static OperateResult<byte[]> BuildStopCommand(byte cpu)
		{
			byte[] array = new byte[4];
			array[0] = 70;
			array[1] = cpu;
			return OperateResult.CreateSuccessResult<byte[]>(array);
		}

		/// <summary>
		/// 构建读取特殊模块的命令报文
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="moduleUnit">模块单元号</param>
		/// <param name="moduleSlot">模块站号</param>
		/// <param name="dataPosition">数据位置</param>
		/// <param name="length">长度信息</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A2 RID: 1442 RVA: 0x00019EE8 File Offset: 0x000180E8
		public static List<byte[]> BuildReadSpecialModule(byte cpu, byte moduleUnit, byte moduleSlot, ushort dataPosition, ushort length)
		{
			List<byte[]> list = new List<byte[]>();
			OperateResult<int[], int[]> operateResult = HslHelper.SplitReadLength((int)dataPosition, length, 64);
			for (int i = 0; i < operateResult.Content1.Length; i++)
			{
				byte[] array = new byte[10];
				array[0] = 49;
				array[1] = cpu;
				array[2] = BitConverter.GetBytes(array.Length - 4)[1];
				array[3] = BitConverter.GetBytes(array.Length - 4)[0];
				array[4] = moduleUnit;
				array[5] = moduleSlot;
				array[6] = BitConverter.GetBytes(operateResult.Content1[i])[1];
				array[7] = BitConverter.GetBytes(operateResult.Content1[i])[0];
				array[8] = BitConverter.GetBytes(operateResult.Content2[i])[1];
				array[9] = BitConverter.GetBytes(operateResult.Content2[i])[0];
				list.Add(array);
			}
			return list;
		}

		/// <summary>
		/// 构建读取特殊模块的命令报文，需要传入高级地址，必须以 <b>Special:</b> 开头表示特殊模块地址，示例：Special:cpu=1;unit=0;slot=1;100<br />
		/// To construct a command message to read a special module, the advanced address needs to be passed in. 
		/// It must start with <b>Special:</b> to indicate the address of the special module, for example: Special:cpu=1;unit=0;slot=1;100
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">高级的混合地址，除了Cpu可以不携带，例如：Special:unit=0;slot=1;100</param>
		/// <param name="length">长度信息</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A3 RID: 1443 RVA: 0x00019FB8 File Offset: 0x000181B8
		public static OperateResult<List<byte[]>> BuildReadSpecialModule(byte cpu, string address, ushort length)
		{
			bool flag = address.StartsWith("Special:") || address.StartsWith("special:");
			if (flag)
			{
				address = address.Substring(8);
				cpu = (byte)HslHelper.ExtractParameter(ref address, "cpu", (int)cpu);
				OperateResult<int> operateResult = HslHelper.ExtractParameter(ref address, "unit");
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					return OperateResult.CreateFailedResult<List<byte[]>>(operateResult);
				}
				OperateResult<int> operateResult2 = HslHelper.ExtractParameter(ref address, "slot");
				bool flag3 = !operateResult2.IsSuccess;
				if (flag3)
				{
					return OperateResult.CreateFailedResult<List<byte[]>>(operateResult2);
				}
				try
				{
					return OperateResult.CreateSuccessResult<List<byte[]>>(YokogawaLinkTcp.BuildReadSpecialModule(cpu, (byte)operateResult.Content, (byte)operateResult2.Content, ushort.Parse(address), length));
				}
				catch (Exception ex)
				{
					return new OperateResult<List<byte[]>>("Address format wrong: " + ex.Message);
				}
			}
			return new OperateResult<List<byte[]>>("Special module address must start with Special:");
		}

		/// <summary>
		/// 构建读取特殊模块的命令报文
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="moduleUnit">模块单元号</param>
		/// <param name="moduleSlot">模块站号</param>
		/// <param name="dataPosition">数据位置</param>
		/// <param name="data">数据内容</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A4 RID: 1444 RVA: 0x0001A0B0 File Offset: 0x000182B0
		public static byte[] BuildWriteSpecialModule(byte cpu, byte moduleUnit, byte moduleSlot, ushort dataPosition, byte[] data)
		{
			byte[] array = new byte[10 + data.Length];
			array[0] = 50;
			array[1] = cpu;
			array[2] = BitConverter.GetBytes(array.Length - 4)[1];
			array[3] = BitConverter.GetBytes(array.Length - 4)[0];
			array[4] = moduleUnit;
			array[5] = moduleSlot;
			array[6] = BitConverter.GetBytes(dataPosition)[1];
			array[7] = BitConverter.GetBytes(dataPosition)[0];
			array[8] = BitConverter.GetBytes(data.Length / 2)[1];
			array[9] = BitConverter.GetBytes(data.Length / 2)[0];
			data.CopyTo(array, 10);
			return array;
		}

		/// <summary>
		/// 构建写入特殊模块的命令报文，需要传入高级地址，必须以 <b>Special:</b> 开头表示特殊模块地址，示例：Special:cpu=1;unit=0;slot=1;100<br />
		/// To construct a command message to write a special module, the advanced address needs to be passed in. 
		/// It must start with <b>Special:</b> to indicate the address of the special module, for example: Special:cpu=1;unit=0;slot=1;100
		/// </summary>
		/// <param name="cpu">Cpu Number</param>
		/// <param name="address">高级的混合地址，除了Cpu可以不携带，例如：Special:unit=0;slot=1;100</param>
		/// <param name="data">写入的原始数据内容</param>
		/// <returns>原始的报文命令</returns>
		// Token: 0x060005A5 RID: 1445 RVA: 0x0001A144 File Offset: 0x00018344
		public static OperateResult<byte[]> BuildWriteSpecialModule(byte cpu, string address, byte[] data)
		{
			OperateResult<List<byte[]>> operateResult = YokogawaLinkTcp.BuildReadSpecialModule(cpu, address, 0);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				byte[] array = new byte[10 + data.Length];
				array[0] = 50;
				array[1] = operateResult.Content[0][1];
				array[2] = BitConverter.GetBytes(array.Length - 4)[1];
				array[3] = BitConverter.GetBytes(array.Length - 4)[0];
				array[4] = operateResult.Content[0][4];
				array[5] = operateResult.Content[0][5];
				array[6] = operateResult.Content[0][6];
				array[7] = operateResult.Content[0][7];
				array[8] = BitConverter.GetBytes(data.Length / 2)[1];
				array[9] = BitConverter.GetBytes(data.Length / 2)[0];
				data.CopyTo(array, 10);
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x060005A6 RID: 1446 RVA: 0x0001A22B File Offset: 0x0001842B
		public override string ToString()
		{
			return string.Format("YokogawaLinkTcp[{0}:{1}]", this.IpAddress, this.Port);
		}
	}
}
